package com.ztmao.shortlink.project.mq.producer;

import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;

import java.util.Map;
/**
 * 短链接监控状态保存消息队列生产者
 *
 */
@Component
@RequiredArgsConstructor
public class ShortLinkStatsSaveProducer {
    private final StringRedisTemplate stringRedisTemplate;
    @Value("${spring.data.redis.channel-topic.short-link-stats}")
    private String topic;
    /**
     * 发送延迟消费短链接统计
     */
    public void send(Map<String ,String> productMap){
        stringRedisTemplate.opsForStream().add(topic,productMap);
    }
}
